package com.lhn.feign;

import com.lhn.entity.Menu;
import com.lhn.entity.Type;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * @author lhn
 * @date 2024-10-09 21:21
 */

@FeignClient(name = "menu")
public interface MenuFeign {

    @GetMapping("menu/findAll/{index}/{limit}")
    List<Menu> findAll(@PathVariable("index") int index, @PathVariable("limit") int limit);

    @GetMapping("menu/findAllWithType/{index}/{limit}")
    List<Menu> findAllWithType(@PathVariable("index") int index, @PathVariable("limit") int limit);

    @GetMapping("menu/count")
    int count();

    @GetMapping("menu/deleteById/{id}")
    void deleteById(@PathVariable("id") long id);

    @GetMapping("type/findAllType")
    List<Type> findAllType();

    @PostMapping("menu/save")
    void save(Menu menu);

    @PostMapping("menu/update")
    void update(Menu menu);

    @GetMapping("menu/findById/{id}")
    Menu findById(@PathVariable("id") long id);

}
